<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>出入境办理进度查询</title>
    <link type="text/css" href="<c:url value='/resource/wx/css/common.css'/>" rel="stylesheet"/>
    <style type="text/css">
        .main {
            font-size: 16px;

        }

        .main .btn:active {
            background-color: #3300ff;
            cursor: hand;
        }

        .weui-cells {
            background-color: #FFFFFF;
            line-height: 1.47058824;
            font-size: 17px;
            overflow: hidden;
            position: relative;
        }
        .showDate{
            margin: 15px 15px;
            display: none;
            padding: 10px 10px;
        }

        .weui-cell {
            padding: 10px 15px;
            position: relative;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            align-items: center;
        }

        .weui-label {
            display: block;
            width: 105px;
            word-wrap: break-word;
            word-break: break-all;
        }

        .weui-cell__bd {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
        }

        .weui-input {
            width: 100%;
            border: 0;
            outline: 0;
            -webkit-appearance: none;
            background-color: transparent;
            font-size: inherit;
            color: inherit;
            height: 1.47058824em;
            line-height: 1.47058824;
        }

        .weui-cell_vcode {
            padding-top: 0;
            padding-right: 0;
            padding-bottom: 0;
        }

        .weui-vcode-img {
            margin-left: 5px;
            height: 46px;
            vertical-align: middle;
        }

        .weui-cells:before {
            content: " ";
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            height: 1px;
            border-top: 1px solid #e5e5e5;
            color: #e5e5e5;
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
            -webkit-transform: scaleY(0.5);
            transform: scaleY(0.5);
            z-index: 2;
        }

        .weui-cell:before {
            content: " ";
            position: absolute;
            top: 0;
            right: 0;
            height: 1px;
            border-top: 1px solid #e5e5e5;
            color: #e5e5e5;
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
            -webkit-transform: scaleY(0.5);
            transform: scaleY(0.5);
            left: 15px;
            z-index: 2;
        }
    </style>
</head>
<body style="background: #f0f0f0;">
</div>
<div class="main">
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">受理编号：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="code" name="code" placeholder="请输入受理编号">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">身份证号：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="id" name="id" placeholder="请输入身份证号">
            </div>
        </div>

        <div class="weui-cell weui-cell_vcode">
            <div class="weui-cell__hd"><label class="weui-label">验证码</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="verCode" name="validateCode" placeholder="请输入验证码">
            </div>
            <div class="weui-cell__ft">
                <img class="weui-vcode-img" src="" id="codeImg" onclick="getImg()">
            </div>
        </div>
    </div>
    <div style="width: 100%; padding:0 15px;box-sizing: border-box">
        <button id="btn_query" onclick="toSubmit();" class="btn simple1 no-border" style="width: 100%">查 询</button>
    </div>

    <div class="showDate" id="showDate">
    </div>
    <input type="hidden" name="validateId" id="validateId" value="1">
</div>
<script type="text/javascript" src="<c:url value='/resource/wx/js/jquery-2.1.1.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resource/wx/js/common.js'/>"></script>
<script type="text/javascript" src="https://gaapi.jl.gov.cn/logservice/resource/js/os.analystic-1.4.min.js"></script>
<script type="text/javascript" src="<c:url value='/resource/wx/js/util.js'/>"></script>
<script type="text/javascript">

    var genGuid;
    $(function () {
        getImg();
    });
    function getImg() {
        genGuid = newGuid().ToString("D");
        $("#validateId").val(genGuid);
        $.ajax({
            url: '<c:url value="/api/code/get/'+ genGuid +'" />',
            type: 'get',
            dataType: 'json',
            success: function (resp) {
                if (resp && resp.succ) {
                    $("#codeImg").attr("src", "data:image/png;base64," + resp.data)
                } else {
                    alert(resp.msg);
                }
            }
        });
    }

    function toSubmit() {
        var code = $("#code").val();

        if (code == "") {
            toast("请输入受理编号", 1500);
            return false;
        }
        var id = $("#id").val();
        if (id == "") {
            toast("请输入身份证号", 1500);
            return;
        }
        var verCode = $("#verCode").val();
        if (verCode == "") {
            toast("请输入验证码", 1500);
            return;
        }
        $.ajax({
            url: "http://localhost:8080/ec/weixinquery/getEntry",
            data: {"id": id, "code": code, "validCode": verCode, "genGuid": genGuid},
            type: 'post',
            dateType:'json',
            success: function (resp) {
                if (resp.succ) {
                    var html=""
                    html+="<div>身份证号:"+resp.data.id_card+"</div>";
                    html+="<div>受理编号:"+resp.data.task_code+"</div>";
                    html+="<div>申请种类:"+resp.data.apply_type+"</div>";
                    html+="<div>受理状态:"+resp.data.apply_status+"</div>";
                    $("#showDate").css("display","block");
                    $("#showDate").html(html);
                } else {
                    $("#showDate").html("");
                    toast(resp.msg);
                }
            },
            error: function () {
                toast("查询异常");
            }
        });
    }

</script>
</body>
</html>
